﻿using GrainManage.Entities.District;
using GrainManage.Server.Business;
using System.Web.Mvc;

namespace GrainManage.Server.Controllers
{
    public class DistrictController : BaseController
    {
        private readonly DistrictBusiness business = new DistrictBusiness();

        //************************************************POST************************************************
        [HttpPost]
        public ActionResult GetByID(InputGetByID input)
        {
            var result = business.GetByID(input);
            return NewtonsoftJson(result);
        }

        [HttpPost]
        public ActionResult Search(InputSearch input)
        {
            var result = business.Search(input);
            return NewtonsoftJson(result);
        }

        [HttpPost]
        public ActionResult GetFatherName(InputGetFather input)
        {
            var result = business.GetFather(input);
            return NewtonsoftJson(result);
        }

        [HttpPost]
        public ActionResult GetChildName(InputGetChild input)
        {
            var result = business.GetChild(input);
            return NewtonsoftJson(result);
        }

        [HttpPost]
        public ActionResult GetUpwardDistrict(InputGetUpwardDistrict input)
        {
            var result = business.GetUpwardDistrict(input);
            return NewtonsoftJson(result);
        }

        [HttpPost]
        public ActionResult GetChildDistrict(InputGetDownwardDistrict input)
        {
            var result = business.GetDownwardDistrict(input);
            return NewtonsoftJson(result);
        }


    }
}
